import cv2 as cv
import numpy as np

img = cv.imread('../test_datas/j.png',0)
kernel = np.ones((5, 5), np.uint8)

gradient = cv.morphologyEx(img, cv.MORPH_GRADIENT, kernel)

erosion = cv.erode(img, kernel,iterations = 1)
dilation = cv.dilate(img, kernel,iterations = 1)
dme = dilation - erosion

res = np.hstack((img, gradient,dme))

cv.imshow('res',res)

cv.waitKey(0)
cv.destroyAllWindows()
